/**
 * 
 */
package com.volatileshooter.entity.bullets;

import java.util.Iterator;

import com.volatileshooter.entity.Bucket;
import com.volatileshooter.entity.BucketManager;
import com.volatileshooter.entity.Entity;

/**
 * @author Ahmed
 *
 */
public class BulletBucketManager implements BucketManager {
	private static float BULLET_LIFE = 50;

	/* (non-Javadoc)
	 * @see com.volatileshooter.entity.BucketController#update(float, com.volatileshooter.entity.Bucket)
	 */
	@Override
	public void update(float dt, Bucket bucket) {
		// check to see which ones are still alive
		Iterator<Entity> it = bucket.getEntities().iterator();
		while (it.hasNext()) {
			BulletEntity entity = (BulletEntity)it.next();
			if (entity.getLife() >= BULLET_LIFE) {
				it.remove();
			}
		}
		// TODO: send information regarding the bullets to the network here. Better to do it in bulk than 1 by 1
	}

}
